<script setup>
import { useCounterStore } from '@/stores'
const data = useCounterStore()
</script>

<template>
  <div v-if="data.animate" id="centrepanel">
    <div>
      <img src='@/assets/img/jiantou.png' alt="">
      <span>Button</span>
    </div>
    <div>
      <img src='@/assets/img/jiantou.png' alt="">
      <span>Button</span>
    </div>
    <div>
      <img src='@/assets/img/jiantou.png' alt="">
      <span>Button</span>
    </div>
    <div>
      <span>Button</span>
      <img src='@/assets/img/jiantou.png' alt="">
    </div>
    <div>
      <span>Button</span>
      <img src='@/assets/img/jiantou.png' alt="">
    </div>
    <div>
      <span>Button</span>
      <img src='@/assets/img/jiantou.png' alt="">
    </div>
  </div>
</template>

<style lang="scss" scoped>
#centrepanel {
  div {
    position: absolute;
    z-index: 1;
    display: flex;
    align-items: center;

    &:nth-child(1) {
      top: vh(332px);
      right: vw(506px);
      animation: slideIn2 1s ease-in-out;
    }

    &:nth-child(2) {
      top: vh(558px);
      right: vw(471px);
      animation: slideIn2 1s ease-in-out;
    }

    &:nth-child(3) {
      top: vh(734px);
      right: vw(559px);
      animation: slideIn2 1s ease-in-out;
    }

    &:nth-child(4) {
      top: vh(734px);
      left: vw(636px);
      animation: slideIn1 1s ease-in-out;

      img {
        transform: rotate(180deg);
      }
    }

    &:nth-child(5) {
      top: vh(558px);
      left: vw(543px);
      animation: slideIn1 1s ease-in-out;

      img {
        transform: rotate(180deg);
      }
    }

    &:nth-child(6) {
      top: vh(332px);
      left: vw(577px);
      animation: slideIn1 1s ease-in-out;

      img {
        transform: rotate(180deg);
      }
    }

    span {
      width: vw(104px);
      height: vh(39px);
      line-height: vh(39px);
      background: url('../../assets/img/buttonback.png') no-repeat center/100% 100%;
      font-size: rem(14.33px);
      color: #7b8c9b;
      text-align: center;
      cursor: pointer;
    }
  }
}

// 左侧动画
@keyframes slideIn1 {
  0% {
    transform: translateX(100%);
    opacity: 0;
  }

  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

// 右侧动画
@keyframes slideIn2 {
  0% {
    transform: translateX(-100%);
    opacity: 0;
  }

  100% {
    transform: translateX(0);
    opacity: 1;
  }
}
</style>